<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            border: 1px solid black;
            padding: 4px 30px;
            margin-bottom: 4px;
        }
    </style>
</head>

<body>
    <div id="app" class="box">
        <h5>组件A</h5>
        <comp-b></comp-b>
        <comp-c></comp-c>

    </div>
    <script type="module">
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        const CompD = {
            template: `
                <div class="box">
                    <h5>组件D</h5>    
                </div>
            `,
            beforeMount() {
                console.log("===>beforeMount-D");
            },
            mounted() {
                console.log("===>mounted-D");
            },
        }
        const CompE = {
            template: `
                <div class="box">
                    <h5>组件E</h5>    
                </div>
            `,
            beforeMount() {
                console.log("===>beforeMount-E");
            },
            mounted() {
                console.log("===>mounted-E");
            },
        }
        const CompB = {
            template: `
            <div class="box">
                <h5>组件B</h5>    
                </div>
                <comp-d></comp-d>
                <comp-e></comp-e>
                `,

            components: {
                CompD, CompE
            },
            beforeMount() {
                console.log("==>beforeMount-B");
            },
            mounted() {
                console.log("==>mounted-B");
            },
        }
        const CompC = {
            template: `
                <div class="box">
                    <h5>组件C</h5>    
                </div>
            `,
             beforeMount() {
                console.log("==>beforeMount-C");
            },
            mounted() {
                console.log("==>mounted-C");
            },
        }

        createApp({
            data() {
                return {

                }
            },
            components: {
                CompB, CompC
            },
             beforeMount() {
                console.log("=>beforeMount-A");
            },
            mounted() {
                console.log("=>mounted-A");
            },
        }).mount("#app");
    </script>
</body>

</html>